<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="expires" content="Wed,26 Jun 2016 08:21:10 GMT">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
    <meta content="no" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <title>确认购买</title>
    <!--
    <link rel="stylesheet" href="__PUBLIC__/css/reset-mobile.min.css"/>
    <link rel="stylesheet" href="__PUBLIC__/css/style.css"/>
    <link rel="stylesheet" href="__PUBLIC__/css/base.css"/>
    <script src="__PUBLIC__/js/jquery-1.11.1.min.js"></script>
    -->
    <!-- <link rel="stylesheet" href="http://pocdoc-app.qiniudn.com/reset-mobile.min.css"/> -->
    <link rel="stylesheet" href="__PUBLIC__/migrate/css/reset-mobile.min.css"/>
    <link rel="stylesheet" href="__PUBLIC__/css/style.css"/>
    <!-- <link rel="stylesheet" href="http://pocdoc-app.qiniudn.com/base.css"/> -->
    <link rel="stylesheet" href="__PUBLIC__/migrate/css/base.css"/>



</head>
<body>
<div class="se-pre-con"></div>
<div class='top'>
    <a class='top_left'>
        <img src="__PUBLIC__/images/back.png">
    </a>
    <span class='sub_top_title'>确认购买</span>
    <span class='about'></span>
</div>

<div class="confirm">
    <!-- <img src="http://pocdoc-app.qiniudn.com/package_top.png"/> -->
    <img src="/yjxtj/images{$model->imgBig}">

    <div class="confirm_content">
        <div class="table_style">
            <div class="appoint_content">
                <p>
                    <span>名称</span>
                    <span>{$model->name}</span>
                </p>

                <p>
                    <span>原价</span>
                    <span>￥{$model->originalPrice}</span>
                </p>

                <p>
                    <span>现价</span>
                    <span>￥{$model->salePrice}</span>
                </p>

                <p>
                    <span>数量</span>
                    <b class="quantity"><input name="" type="button" value="-" id="subtract">
                        <input type="text" value="1" size="3" style="text-align:center;" id="v" readonly="">
                        <input name="" type="button" value="+" id="add">
                    </b>
                </p>

                <p>
                    <span>共优惠</span>
                    <span id="favor">￥{$favor}</span>
                </p>

                <p>
                    <span>实付款</span>
                    <span id="realPay" class="real_pay">￥{$model->salePrice}</span>
                </p>
            </div>
        </div>
    </div>


</div>
<div class="footer">
    <button id="alipay">使用支付宝支付</button>
</div>
<div class="warning">
    <img src="__PUBLIC__/images/warning_post.png" width="100%"/>
</div>
</body>
<!--  // <script src="http://pocdoc-app.qiniudn.com/jquery-1.11.1.min.js"></script>
 //    页面加载动画js
 // <script   src="http://cdn.bootcss.com/modernizr/2010.07.06dev/modernizr.min.js"></script> -->

    <script src="__PUBLIC__/migrate/js/jquery-1.11.1.min.js"></script>
    <script  src="__PUBLIC__/migrate/js/modernizr.min.js"></script>


    <script >
        $(document).ready(function () {
            $(".top_left").click(function () {
                window.history.back();
            });

            //调整购买数量

            var qu = $("#v").attr("value");
            $('.tab span').click(function () {
                var n = $(this).index();
                $(this).addClass("span").siblings().removeClass('span');
                $(".nr").hide();
                $("#nr" + n).show();
            });

            $('#subtract').click(function () {
                if (qu > 1) {
                    qu--;
                    document.getElementById('v').value = qu;
                    $("#v").val(qu);
                    $("#favor").html("￥" + qu * {$favor});
                    $("#realPay").html("￥" + qu * {$model->salePrice});
                }
            });
            $('#add').click(function () {
                qu++;
                document.getElementById('v').value = qu;
                $("#v").val(qu);
                $("#favor").html("￥" + qu * {$favor});
                $("#realPay").html("￥" + qu * {$model-> salePrice});
            });


            //郁香支付宝支付
            $("#alipay").click(function () {
               // alert("支付正在建设中，敬请期待！");exit;
                var num=$("#v").val();
                // alert(num);exit;
                var salePrice ={$model->salePrice};
                var uid="<?php echo cookie('uid');?>";
               // alert(salePrice);exit;
                $.ajax({
                    // url:"http://localhost/yjxtj/source/h5.php?m=app&a=purchase",   //本地调试
                    url:"/yjxtj/h5.php?m=app&a=purchase",
                    async:true,//同步请求，默认情况下是异步（true）
                    beforeSend:function(){
                        $(".warning").show();
                    },
                    type: 'post',
                    dataType: 'json',
                    data: {
                        uid: uid,
                        packageid: "{$model->packageId}",
                        num: num,
                        totalprice: num*salePrice,
                    },
                    error:function(request) {
                        alert("Connection error");
                    },
                    success: function(data) {
                        if (data.status == 1)
                            {
                                document.write('<form name=payForm><input type=hidden name=WIDseller_email><input type=hidden name=WIDout_trade_no><input type=hidden name=WIDsubject><input type=hidden name=WIDtotal_fee><input type=hidden name=WIDbody><input type=hidden name=WIDshow_url><input type="hidden" name=WIDextern_token><input type="hidden" name=WIDit_b_pay></form>');
                                var myForm = document.forms['payForm'];
                                myForm.action = "{$payinfo.action}";
                                myForm.method = 'POST';
                                myForm.WIDseller_email.value = "{$payinfo.account}";
                                myForm.WIDout_trade_no.value = data.msg.sn;
                                myForm.WIDsubject.value = data.msg.name;
                                myForm.WIDtotal_fee.value =data.msg.totalprice;
                                myForm.WIDbody.value = data.msg.descption;
                                myForm.WIDshow_url.value = '';
                                myForm.WIDextern_token.value = '';
                                myForm.WIDit_b_pay.value = '';
                                myForm.submit();
                            }
                        }
            });
            });

             //页面加载动画
                $(window).load(function() {
                // Animate loader off screen
                    $(".se-pre-con").fadeOut("slow");;
                });
        });
    </script>



</html>
